package app

import (
	"context"
	"github.com/gin-gonic/gin"
)

type Application struct {
	cancel context.CancelFunc
	C      context.Context
	*gin.Engine
}

func (a *Application) Cancel() {
	a.cancel()
}

func NewApplication() *Application {
	gin.SetMode(gin.ReleaseMode)
	gin.DisableConsoleColor()

	app := gin.New()

	ctx, cancel := context.WithCancel(context.TODO())

	return &Application{
		Engine: app,
		C:      ctx,
		cancel: cancel,
	}
}
